<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\LinkPager;

?>

<style>
    .listInfo li:not(:first-child):before{
        content: ',';
        margin: 0 8px;
    }
</style>
<div class="row">
    <div class="container lh30">
        <a class="topNav" href="<?=Url::toRoute('/system/site/index')?>" style=""><img src="<?=Yii::getAlias('@web/backend/img/home/home.png');?>" alt="首页"/>返回首页</a>
    </div>
</div>

<div class="row nav-brand-bg borB">
    <div class="container lh30">
        <ul class="nav nav-tabs">
            <li><a href="<?=Url::toRoute(['repertory/repertorymanage']) ?>" style="">库存管理</a></li>
            <li><a href="<?=Url::toRoute(['repertoryinc/storage','type' => 1]) ?>" style="">商品入库</a></li>
            <li><a href="<?=Url::toRoute(['goodsdec/repertoryout','type' => 1]) ?>">商品出库</a></li>
            <li class="active"><a href="<?=Url::toRoute(['repertoryinc/increcord']) ?>">入库流水</a></li>
            <li><a href="<?=Url::toRoute(['goodsdec/decrecord']) ?>">出库流水</a></li>
        </ul>
    </div>
</div>


<div class="tab-content">
    <div id="income" class="row tab-pane in active fade">

        <div class="container">
            <div>

            </div>
            <form method="get" class="">
            <div class="mg20-y lh45 list clearfix" style="word-spacing: -6px;">
                <span class="mr20">日期</span>
                <input class="lh45 laydate-icon" type="text" name="start_time" value="<?=$start_time?>" onclick="laydate()">
                <span class="mg20-x">至</span>
                <input class="lh45 mr20 laydate-icon" type="text" name="end_time" value="<?=$end_time?>" onclick="laydate()">

                <a class="btnBg mr20" style="width: 75px; color: #fff;border-radius: 6px; height: 45px;">
                    <input type="submit" value="搜索" style="display: block; width: 100%; background: 0;border:0;line-height: 45px; font-size: 17px;">
                </a>
                <a class="btnBg dis text-center lh45" href="<?= Url::toRoute(['repertoryinc/incexcel']) ?>"><img
                        src="<?= Yii::getAlias('@web/backend/img/stocks/excel.png'); ?>" alt=""
                        style="margin-right: 9px;vertical-align: text-top;"/>导出EXCEL</a>
            </div>
            </form>

            <?php if(empty($data)){?>
            <table class="table table-bordered mt20">
                <thead>
                    <tr>
                        <th>日期</th>
                        <th>共计数量</th>
                        <th>入库明细</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td colspan="4" align="center"><img src="<?=Yii::getAlias('@web/backend/img/nodata.gif');?>"></td>
                    </tr>
                </tbody>
            </table>
            <?php }else{?>
            <table class="table table-bordered mt20">
                <thead>
                    <tr>
                        <th>日期</th>
                        <th>共计数量</th>
                        <th>入库明细</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                <?php foreach ($data as $d){?>
                <tr>
                    <td><?=Html::encode(substr($d['date'], 0,10)) ?></td>
                    <td><?=Html::encode($d['count']) ?></td>
                    <td>
                        <ul class="listInfo clearfix">
                            <?php for ($i=0; $i<count($d['record']);$i++ ){?>
                                <li class="pull-left"><?=Html::encode($d['record'][$i]) ?></li>
                            <?php }?>
                        </ul>
                    </td>
                    <td><a class="detal btn btn-sm btn-borB" dhref="<?=Url::toRoute(['repertoryinc/increcorddetal','unique_flag' => $d['unique_flag']]) ?>" href="javascript:void(0)">查看明细</a></td>
                </tr>
                <?php }?>
                </tbody>
            </table>


            <div class="page">
		        <?=LinkPager::widget([
                    'pagination' => $page,
	                'firstPageLabel' => '首页',
	                'nextPageLabel' => '下一页',
	                'prevPageLabel' => '上一页',
	                'lastPageLabel' => '末页',
                ]); ?>
            </div>
            <?php }?>
        </div>

    </div>

</div>

<?php $this->beginBlock('js_index_end') ?>
    $(function(){

laydate.skin('meelier');

        $('.listInfo').each(function(){
        $(this).children(":gt(2)").hide();
        })

	    function openPage() {
            var obj = $(this);
            var url = obj.attr('dhref');
            layer.open({
                type: 2,
                title: '',
                shadeClose: false,
                shade: 0.8,
                maxmin: true, //开启最大化最小化按钮
                area: ['65%', '65%'],
                content: url
            });
        }
       $('.detal').on('click', openPage);
    })
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['js_index_end'], $this::POS_END); ?>







